<template>
  <div class="header" @click="onJump">
    <van-icon name="arrow-left" v-if="path" />
    <span>{{ title }}</span>
  </div>
</template>
<script>
export default {
  name: "common-header",
  props: {
    title: String,
    path: String,
  },
  methods: {
    onJump() {
      if (this.path) this.$router.push(this.path);
    },
  },
};
</script>

<style lang="less" scoped>
.header {
  cursor: pointer;
  height: 3rem;
  background-color: #0495e2;
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  padding-left: 0.8rem;
  > span {
    margin-left: 0.4rem;
  }
}
</style>
